package com.mdmedia.common.test;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.mdmedia.cms.entiy.base.User;
import com.mdmedia.common.dao.ICommonDaoService;

@Service("userService")
public class UserServiceImpl implements UserService {
	@Autowired
	@Qualifier("userDao")
	private IUserDao userDao;
	
	@Autowired
	@Qualifier("commonDaoService")
	private ICommonDaoService commonDaoService;
	
	@Override
	public User getUser(User user) {
		String hql = " from com.mdmedia.cms.entiy.base.User ";
		List list = commonDaoService.getListByHQL(hql);
		if(list.size()>0){
			user = (User) list.get(0);
		}
		return user;
	}
	public void setUserDao(IUserDao userDao) {
		this.userDao = (IUserDao) userDao;
	}
	@Override
	public void delete(User user) {
		// TODO Auto-generated method stub
		userDao.delete(user);
	}
	@Override
	public void save(User user) {
		// TODO Auto-generated method stub
		userDao.save(user);
	}
}
